/**
 * 
 */
package com.oauth.global.client.ui.status;

import java.util.Map;

import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Widget;
import com.oauth.components.client.ui.HasWidgetInfo;
import com.oauth.global.client.ui.GlobalResources;

/**
 * @author asanthan
 * 
 */
public class StatusWidgetInfo extends Composite implements HasWidgetInfo {

	public static final Long APPLICATION_ID = -2l;
	private static StatusWidgetInfoUiBinder uiBinder = GWT.create(StatusWidgetInfoUiBinder.class);

	interface StatusWidgetInfoUiBinder extends UiBinder<Widget, StatusWidgetInfo> {
	}

	private static String name = "Status Update";
	private Image icon;
	private Image image;

	@UiField
	StatusPanel statusPanel;

	public StatusWidgetInfo() {
		initWidget(uiBinder.createAndBindUi(this));
		icon = new Image();
		icon.setResource(GlobalResources.INSTANCE.statusIcon());
		image = new Image();
	}

	public void setWidgetMap(Map<Long, HasWidgetInfo> widgetMap) {
		statusPanel.setWidgetMap(widgetMap);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.oauth.components.client.ui.HasWidgetInfo#init()
	 */
	@Override
	public void init() {
		statusPanel.initImages();
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.oauth.components.client.ui.HasWidgetInfo#getName()
	 */
	@Override
	public String getName() {
		return name;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.oauth.components.client.ui.HasWidgetInfo#getIcon()
	 */
	@Override
	public Image getIcon() {
		return icon;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.oauth.components.client.ui.HasWidgetInfo#getWidgetImage()
	 */
	@Override
	public Image getWidgetImage() {
		return image;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.oauth.components.client.ui.HasWidgetInfo#getWidgetUI()
	 */
	@Override
	public Widget getWidgetUI() {
		return statusPanel;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.oauth.components.client.ui.HasWidgetInfo#getId()
	 */
	@Override
	public Long getId() {
		return APPLICATION_ID;
	}

}
